﻿@{
    ViewBag.Title = "推送配置";
    Layout = "~/Views/Shared/_Main.cshtml";
}
@section Head{
    <style type="text/css">
        .pagTable
        {
            width: 100px;
            overflow: hidden;
            table-layout: fixed;
            border-top: solid 1px #ccc;
            border-left: solid 1px #ccc;
        }
        .pagTable td
        {
            height: 25px;
            border-right: 1px solid #ccc;
            border-bottom: 1px solid #ccc;
            padding-left: 3px;
            line-height: 20px;
            word-break: keep-all; /* 不换行 */
            white-space: nowrap; /* 不换行 */
            overflow: hidden; /* 内容超出宽度时隐藏超出部分的内容 */
            text-overflow: ellipsis; /* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用。*/
        }
        .pagTable .tr_c2
        {
            background-color: rgb(238, 238, 255);
        }
        .pagTablehd
        {
            background-image: url('/images/datagrid_header_bg.gif');
        }
    </style>
    <script src="/Scripts/date.format.js" type="text/javascript"></script>
    <script type="text/javascript">
        var UrlArray = $.getUrlArray();
         
        $(function () {
            page_Init(); 
        });

        function page_Init() { 
            $(".pagTable tr:even").attr("class", "tr_c2");
            $(".pagTable tr:first").attr("class", "pagTablehd");
        }

        function btnSubmit_Click() {
            submitForm();
        }

        function btnClose_Click() {
            returnParent(null);
        }
        function select_All(n) {
            var selector = $("#formArea tr:not(:first)");
            selector.find(':input[name*="' + n + '"]').attr('checked', $(event.srcElement).is(':checked')).change();
        }

        function submitForm() {
            var dbName = encodeURI(UrlArray["dbName"]);
            var systemID = UrlArray["systemID"];
            var groupID = UrlArray["groupID"];

            if ($('#ff').form("validate")) {
                var postUrl = "/ViewGroup/UpdateViewModelPushConfig?dbName=" + dbName + "&systemID=" + systemID + "&groupID=" + groupID;
                var postData = $('#ff').serialize();
                postData = $(":checkbox,:hidden").serialize();
                $.ajax({
                    type: "POST",
                    async: true,
                    url: postUrl,
                    data: postData,
                    success: function (result) {
                        if (result.Success == true) {
                            alert(result.Message);
                            returnParent(null);
                        }
                        else {
                            alert(result.Message);
                        }
                    }
                });
            }
        }
    </script>
}
<div style="height: 470px; padding-left: 5px; padding-right: 18px; overflow: hidden;
    overflow-y: scroll;">
    <table class="listTitle">
        <tr>
            <td width="15">
                <img src="/images/filesave.png" />
            </td>
            <td width="300">
                视图推送配置<span id="type_Name"></span>
            </td>
            <td align="right">
                <input id="btnSubmit" type="button" value="保 存" class="button" onclick="btnSubmit_Click()" />
                <input id="btnClose" type="button" value=" 关 闭 " class="button" onclick="btnClose_Click()" />
            </td>
        </tr>
    </table>
    <form id="ff" method="post">
    <table id="formArea" class="pagTable" style="width: 100%;" border="0" cellpadding="0"
        cellspacing="0">
        <tr class="pagTablehd">
            <td style="">
                模型名称
            </td>
            <td style="">
                推送名称
            </td>
            @*<td style="width: 80px;">
                视图类型
            </td>*@
            <td style="width: 80px;">
                <label>
                    <input type="checkbox" onclick="select_All('IsSSISPush');" class="IsSSISPush" />
                    SSIS推送</label>
            </td>
            <td style="width: 80px;" title="WebService推送">
                <label>
                    <input type="checkbox" onclick="select_All('IsWebServicePush');" class="IsWebServicePush" />WS推送</label>
            </td>
            <td style="width: 80px;" title="全量">
                <label>
                    <input type="checkbox" onclick="select_All('IsFullAmount');" class="IsFullAmount" />全量</label>
            </td>
            @*<td style="width: 80px;" title="">
                <label>
                    <input type="checkbox" onclick="select_All('IsDisable');" class="IsDisable" />IsDisable</label>
            </td>*@
            <td style="width: 80px;" title="物理删除">
                <label>
                    <input type="checkbox" onclick="select_All('DeletedType');" class="DeletedType" />物理删除</label>
            </td>
            @*<td style="width: 80px;" title="">
                <label>
                    <input type="checkbox" onclick="select_All('IsBackDelete');" class="IsBackDelete" />IsBackDelete</label>
            </td>*@
        </tr>
        @Html.Raw(ViewBag.ViewConfigHtml)
    </table>
    <div>
        <div id="Pagination" class="pagination">
        </div>
        <div id="loading" class="loading">
            <img src="/Images/tree_loading.gif" />
        </div>
    </div>
    <div id="msg">
    </div>
    </form>
</div>
